<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=EDGE" charset=UTF-8/>
		<link rel="stylesheet" type="text/css" href="resources/styles/GeneralStyle.css"/>
		<title>BCF - Main Page</title>
		  <script id="sap-ui-bootstrap"
	  		data-sap-ui-theme="sap_ux"
      		type="text/javascript"
       		data-sap-ui-libs="sap.ui.commons"
      		src="resources/sap-ui-core.js">
    	</script > 
    	<script src="resources/JavaScript/common.js"></script>
    	<script>
    	//jQuery.sap.require("sap.ui.commons.MessageBox");
    	
    	showValidationError("${validationError}");
    	
    	function verifyPendingChanges()
    	{
    		/*var currentBCName = "${BC.name}"; 
    		return document.getElementById("tbxBcName").value != currentBCName;*/
    		var parameter = "&bcName=" + document.getElementById("tbxBcName").value;
    		
    		sendRequest(null, "main", "saveMainData", null, parameter);
    		return false;
    	}
    	
    	function validateForm()
    	{
    		var isValid = true;
    		
    		/*var bcName = document.getElementById("tbxBcName").value;
    		if(bcName.trim() != "")
    			document.forms["frMain"].submit();
    		else
    		{
    			try{sap.ui.commons.MessageBox.show("Please, enter a value for the Business Case name field.", sap.ui.commons.MessageBox.Icon.ERROR, "Validation Error");}
    			catch(ex){alert("Please, enter a value for the Business Case name field.");}
    			
    			document.getElementById("tbxBcName").focus();
    			
    			isValid = false;
    		}*/
			var parameter = "&bcName=" + document.getElementById("tbxBcName").value;
    		sendRequest(null, "main", "saveMainData", handleRequest, parameter);
    		
    		return isValid;
    	}
    	</script>
	</head>
	<body onload="initializePage('main','BCF - Main Page')">
		<%@include file="/webPages/_header.jsp" %>
     	<div id="preview" class="sapUiBody" >
			<form id="frMain" title="Main Form" action="main" method="post">
	 			<fieldset title="Business Case Properties" id="fsBC">
	 				<legend>Business Case Properties</legend>
	 				<label>Business Case Name: </label>
	 				<input type="text" id="tbxBcName" name="bcName" class="textBox" value="${BC.name}">
	 			</fieldset>
	 			<input type="button" value="Submit Changes" class="formButton" onclick="validateForm()">
	 		</form>	
      	</div>
       	<%@include file="/webPages/_footer.jsp" %> 
	</body>
</html>